﻿namespace Sidvall.ExceptionHandling
{
	public class ExceptionManager
	{
		#region Public Members

		public Sidvall.ExceptionHandling.IExceptionProvider ExceptionProvider { get; set; }

		#region GetMessage

		public string GetMessage(System.Exception ex)
		{
			return GetMessage(new System.Exception[] { ex }, System.Environment.NewLine, System.Environment.NewLine + System.Environment.NewLine);
		}
		public string GetMessage(System.Exception ex, string separator)
		{
			return GetMessage(new System.Exception[] { ex }, separator, separator);
		}
		public string GetMessage(System.Exception ex, string messageSeparator, string sectionSeparator)
		{
			return GetMessage(new System.Exception[] { ex }, messageSeparator, sectionSeparator);
		}
		public string GetMessage(System.Collections.Generic.IEnumerable<System.Exception> exceptions)
		{
			return GetMessage(exceptions, System.Environment.NewLine, System.Environment.NewLine + System.Environment.NewLine);
		}
		public virtual string GetMessage(System.Collections.Generic.IEnumerable<System.Exception> exceptions, string messageSeparator, string sectionSeparator)
		{
			return this.ExceptionProvider.GetMessage(exceptions, messageSeparator, sectionSeparator);
		}

		#endregion

		#region ToString

		public override string ToString()
		{
			return "ExceptionManager - Sidvall.ExceptionHandling.IExceptionProvider";
		}

		#endregion

		#endregion
		#region Constructors

		public ExceptionManager(Sidvall.ExceptionHandling.IExceptionProvider exceptionProvider)
		{
			this.ExceptionProvider = exceptionProvider;
		}

		#endregion
	}
}
